<template>
  <div>
    <h1>我是哥哥我开{{ car }}</h1>
    <button @click="change('奥迪A8L')">换车</button>
  </div>
</template>

<script>
export default {
  name: "Child1",
  props: ["car", "changeCar"],
  methods: {
    change(car) {
      this.changeCar(car);
    },
  },

  //子组件更新流程 修改的还是父组件的数据
  //父组件beforeUpdate ---> 子组件1111beforeUpdate1111 ---> 子组件2222beforeUpdate2222
  //---> 子组件1111updated1111 ---> 子组件2222updated2222 ---> 父组件updated

  beforeCreate() {
    console.log("1111beforeCreate1111");
  },

  created() {
    console.log("1111created1111");
  },

  beforeMount() {
    console.log("1111beforeMount1111");
  },

  mounted() {
    console.log("1111mounted1111");
  },

  beforeUpdate() {
    console.log("1111beforeUpdate1111");
  },

  updated() {
    console.log("1111updated1111");
  },

  beforeDestroy() {
    console.log("1111beforeDestroy1111");
  },

  destroyed() {
    console.log("1111destroyed1111");
  },
};
</script>

<style>
</style>